<?php

	class MySQL {
		private $link = NULL;
		
		function __construct($dbconf) {
			$host = $dbconf['host'];
			$port = $dbconf['port'];
			$db = $dbconf['db_name'];
			$u = $dbconf['user'];
			$p = $dbconf['password'];
			
			$this->link = mysql_connect("$host:$port", $u, $p);
			if (!$this->link) {
			}
			if (!mysql_select_db($db, $this->link)) {
			}
		}
		
		function sql_execute($sql) {
			return mysql_query($sql, $this->link);
		}
		
		function truncate_table($table_nm) {
			mysql_query("TRUNCATE TABLE $table_nm", $this->link);
		}
	}

?>